// Copyright 2019 The rhyme_lph Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// c [author] rhyme_lph
// e [email]  rhymelph@gmail.com
// g [github] https://github.com/rhymelph

import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/l10n.dart';
import 'package:finance_app/src/page/all_reports/bank_reconciliation/views/reconcile_account_view.dart';
import 'package:finance_app/src/page/all_reports/bank_reconciliation/views/view_report_view.dart';
import 'package:finance_app/src/widgets/common_app_bar.dart';
import 'package:finance_app/src/widgets/common_tab_bar.dart';
import 'package:flutter/material.dart';
import 'package:finance_app/src/provider/all_reports/bank_reconciliation/bank_reconciliation_provider.dart';
import 'package:finance_app/src/router_gen/router_meta.dart';

@RouterMeta(paramName: "bankReconciliationPage")
class BankReconciliationPage extends StatefulWidget {
  @override
  _BankReconciliationPageState createState() => _BankReconciliationPageState();
}

class _BankReconciliationPageState extends State<BankReconciliationPage>
    with PagePresenter<BankReconciliationPage, BankReconciliationProvider> {
  @override
  PreferredSizeWidget get appBar =>
      getDefaultAppBar(title: S.current.bank_reconciliation);

  @override
  Widget get buildWidget => DefaultTabController(
        length: 2,
        child: Column(
          children: [
            CommonTabBar(
              tabs: provider.tabs
                  .map((e) => MyTab(
                        text: e,
                      ))
                  .toList(),
            ),
            Expanded(
                child: TabBarView(children: [
              ReconcileAccountView(),
              ViewReportView(),
            ])),
          ],
        ),
      );
}
